import http from '../axios'

interface listType {
  author_avatar?: string
  author_name?: string
  categrory_id?: number
  content: string
  cover_image?: string
  created_at?: string
  id: number
  likes: number
  status: string
  summary: string
  title: string
  updated_at?: string
  views: number
}
// 创建博客文章
export const createBlog = (formData: FormData) => {
  return http.post('/blogs/createBlogPost', formData, {
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  })
}

// 获取博客文章列表
export const getBlogList = () => {
  return http.get<listType[]>('/blogs/list')
}

// 点赞
export const likeBlog = (id: Number, status: Number) => {
  return http.post('/blogs/likeBlog', { id, status })
}
